import React from "react";
import {Image, StyleSheet, Text, TouchableWithoutFeedback, View} from "react-native";
import PropTypes from 'prop-types';
import {getStatusBarHeight} from 'react-native-iphone-x-helper';
import PlatformTouchable from 'react-native-platform-touchable';
//闪屏页
class NetworkErrorView extends React.PureComponent {
  static propTypes = {
    errorInfo: PropTypes.string,
    onPress: PropTypes.func,
    showBackButton: PropTypes.bool,
    backButtonTintColor: PropTypes.string
  };

  static defaultProps = {
    errorInfo: '网络开小差了，请点击重试',
    showBackButton: false
  };

  constructor() {
    super();
    this.state = {};
  }


  render() {
    return (<TouchableWithoutFeedback style={{
      justifyContent: "center",
      alignItems: "center",
      flex: 1
    }} onPress={this.props.onPress}>
      <View style={{alignItems: "center", justifyContent: "center", flex: 1}}>
        <Image source={global.ERROR_IMAGE?global.ERROR_IMAGE:{uri:null}} style={{width: 64, height: 64}}/>
        <Text style={{
          fontWeight: "400",
          fontSize: 16,
          color: "#666666",
          marginLeft: 10,
          marginTop: 15
        }}>{this.props.errorInfo || '网络开小差了，请点击重试'}</Text>
      </View>

    </TouchableWithoutFeedback>)
      ;
  }
}

export default NetworkErrorView;
